import { stringify } from 'qs';
import request from '../utils/request';
import postRequest from '../utils/loginFetch';

export async function fakeSubmitForm(params) {
  return request('/api/forms', {
    method: 'POST',
    body: new FormData(params),
  });
}

//商品表格显示
export async function queryFakeList(params, url) {
  return request(`${url}?${stringify(params)}`);
}

//删除表格数据
export async function deleteTableData(params, url) {
  console.log(`${url}?${stringify(params)}`);
  return request(`${url}?${stringify(params)}`);
}

//导出数据
export async function export_list(params, url) {
  return request(`${url}?${stringify(params)}`);
}

//模态框查询数据
export async function export_model(params, url) {
  return request(`${url}?${stringify(params)}`);
}

//审核信息列表查询
export async function queryReview(params) {
  return request('/web/review', {
    method: 'get',
    body: params,
  });
}

//查看商品信息
export async function queryProduct(params) {
  return request(`/web/productInfo?${stringify(params)}`);
}

//addsku的下拉搜索
export async function querySelect(params) {
  return request(`/web/sku/getSkuSubList?${stringify(params)}`);
}

export async function fakeAccountLogin(params) {
  console.log('触发登录');
  return postRequest('/doLogin', params);
}

export async function fakeRegister(params) {
  return request('/api/register', {
    method: 'POST',
    body: params,
  });
}



export async function queryNotices() {
  return request('/api/notices');
}
